package com.nciae.controller;


import com.nciae.po.Rectification;
import com.nciae.service.IRectificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Guoliyu
 * @since 2022-03-30
 */
@RestController
@RequestMapping("/rectification")
public class RectificationController {

    @Autowired
    private IRectificationService rectificationService;

    @GetMapping("/{id}")
    public ResponseEntity<Rectification> find(@PathVariable("id")Long id) {
        Rectification rectification = rectificationService.findBySecurityQuestionId(id);
        return ResponseEntity.ok(rectification);
    }

    @PostMapping
    public ResponseEntity<Boolean> add(@RequestBody Rectification rectification) {
        rectificationService.add(rectification);
        return ResponseEntity.ok(true);
    }


}
